import request from "@/utils/request";

const baseUrl = "researchPaper/";

/**
 * 获取所有教师社会服务信息
 * @param pagination
 * @param keyword
 * @returns {AxiosInstance}
 */
export function page(pagination, keyword) {
    return new request({
        url: `${baseUrl}list`,
        method: "GET",
        params: {...pagination, ...keyword}
    })
}

/**
 * 添加单个教师社会服务
 * @returns {AxiosInstance}
 * @param data
 */
export function addResearchPaper(data) {
    return new request({
        url: `${baseUrl}`,
        method: "POST",
        data: data
    })
}

/**
 * 修改单个教师社会服务
 * @returns {AxiosInstance}
 * @param data
 */
export function updateResearchPaper(data) {
    return new request({
        url: `${baseUrl}`,
        method: "PUT",
        data: data
    })
}

/**
 * 删除单个教师社会服务
 * @returns {AxiosInstance}
 * @param id
 */
export function deleteResearchPaper(id) {
    return new request({
        url: `${baseUrl}?id=${id}`,
        method: "DELETE",
    })
}

/**
 * 删除多个教师社会服务
 * @returns {AxiosInstance}
 * @param ids
 */
export function deleteMultipleResearchPaper(ids) {
    let filterIds = "?";
    ids.forEach(item => filterIds += `ids=${item}&`);
    filterIds = filterIds.substr(0, filterIds.length - 1);
    return new request({
        url: `${baseUrl}multiple${filterIds}`,
        method: "DELETE",
    })
}

